//
//  PushSuccessViewController.m
//  BGM
//
//  Created by liuqin on 2018/12/3.
//  Copyright © 2018 com.alirtc.demo. All rights reserved.
//

#import "PushSuccessViewController.h"
#import "Common.h"
#import "PushMessageInfoViewController.h"

@interface PushSuccessViewController ()

@end

@implementation PushSuccessViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.1
    self.navview.hidden = NO;
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
    [imageView setImage:[UIImage imageNamed:@"pushSuccess"]];
    [self.view addSubview:imageView];
    imageView.center = CGPointMake(SCREENW/2, 300);
    
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, SCREENW, 50)];
    label.text = @"发布成功";
    label.textAlignment = NSTextAlignmentCenter;
    label.font = [UIFont systemFontOfSize:17];
    [self.view addSubview:label];
    label.center = CGPointMake(SCREENW/2, 375);
    
    UIButton *btn1 = [[UIButton alloc]initWithFrame:CGRectMake(50, SCREENH-200, SCREENW-100, 50)];
    [btn1 setTitle:@"查看详情" forState:UIControlStateNormal];
    btn1.layer.cornerRadius = 6;
    btn1.layer.masksToBounds = YES;
    btn1.backgroundColor = bgmyelloeColor;
    [self.view  addSubview:btn1];
    btn1.tag = 99;
    [btn1 addTarget:self action:@selector(clickNext:) forControlEvents:UIControlEventTouchUpInside];
 
    
    UIButton *btn2 = [[UIButton alloc]initWithFrame:CGRectMake(50, SCREENH-120, SCREENW-100, 50)];
    btn2.tag = 100;
    [btn2 setTitle:@"返回首页" forState:UIControlStateNormal];
    btn2.layer.cornerRadius = 6;
    btn2.layer.masksToBounds = YES;
    btn2.backgroundColor = bgmgrayColor;
    [self.view  addSubview:btn2];
    [btn2 addTarget:self action:@selector(clickNext:) forControlEvents:UIControlEventTouchUpInside];
 }
- (void)clickNext:(UIButton *)btn{
    int tag = (int)btn.tag;
    if (tag == 100) {
        [self clickBack];
    }else{
        PushMessageInfoViewController *vc = [[PushMessageInfoViewController alloc]init];
        vc.messageId = self.messageID;
        vc.isPushRoot = YES;
        vc.isMe = YES;
        [self.navigationController pushViewController:vc animated:YES];
    }
}

- (void)clickBack{
   
    [[NSNotificationCenter defaultCenter]postNotificationName:@"pushVCDismiss" object:nil];
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
